<!--
* @Description: 机构管理 - 表单
* @Author: DHL
* @Date: 2022-03-28 14:25:56
 * @LastEditors: DHL
 * @LastEditTime: 2022-06-15 15:57:00
-->
<template>
  <tw-dialog
    v-model="visible"
    :title="title"
    :loading="loading"
    width="600px"
    height="400px"
    @close="handleClose"
  >
    <el-form
      ref="dbFormRef"
      :model="dbForm"
      :rules="rules"
      label-width="90px"
      :disabled="action === 'view'"
    >
      <el-form-item label="上级机构" prop="parentOrgId">
        <el-input
          v-model="myData.parentOrgName"
          clearable
          placeholder="请输入父级编码"
          :disabled="true"
        ></el-input>
      </el-form-item>

      <el-form-item label="机构编码" prop="code">
        <el-input v-model="dbForm.code" clearable placeholder="请输入机构编码"></el-input>
      </el-form-item>

      <el-form-item label="机构名称" prop="name">
        <el-input v-model="dbForm.name" clearable placeholder="请输入机构名称"></el-input>
      </el-form-item>

      <el-form-item label="机构类型" prop="orgType">
        <el-select v-model="dbForm.orgType" clearable placeholder="请选择机构类型">
          <tw-dic dicKey="ORGANIZATION_TYPE"></tw-dic>
        </el-select>
      </el-form-item>

      <el-form-item label="机构地址" prop="address">
        <el-input
          v-model="dbForm.address"
          clearable
          type="textarea"
          :rows="2"
          placeholder="请输入机构地址"
        ></el-input>
      </el-form-item>
    </el-form>

    <template #footer>
      <el-button @click="handleReset(true)">取 消</el-button>
      <el-button v-if="action === 'add'" type="warning" @click="handleSubmit(true)">
        提交并继续
      </el-button>
      <el-button v-if="action !== 'view'" type="primary" @click="handleSubmit(false)">
        提 交
      </el-button>
    </template>
  </tw-dialog>
</template>

<script src="./useForm.ts"></script>

<style scoped lang="scss"></style>
